package com.jlcloud.core.tenant;

import org.springframework.core.NamedThreadLocal;

/**
 * 租户线程处理
 *
 * @author By: JlCloud <br>
 * @Package: com.jlcloud <br>
 * @CreateTime: 2024-12-03 21:45 <br>
 * @Copyright: 2021 www.jilianjituan.com Inc. All rights reserved. <br>
 * @Caution 注意：本内容仅限于冀联人力集团内部传阅，禁止外泄以及用于其他的商业目的 <br>
 */
public class JlCloudTenantHolder {

	private static final ThreadLocal<Boolean> TENANT_KEY_HOLDER = new NamedThreadLocal<Boolean>("jlcloud-tenant") {
		@Override
		protected Boolean initialValue() {
			return Boolean.FALSE;
		}
	};

	public static void setIgnore(Boolean ignore) {
		TENANT_KEY_HOLDER.set(ignore);
	}

	public static Boolean isIgnore() {
		return TENANT_KEY_HOLDER.get();
	}


	public static void clear() {
		TENANT_KEY_HOLDER.remove();
	}


}
